# 32-bit Survival Guide


## Why should I need to think about my CPU architecture?

Because important packages or software are ending support for 32-bit and others may follow suit. This is [causing](https://www.vice.com/en_us/article/bjwmqm/the-many-ways-planned-obsolescence-is-sabotaging-how-we-preserve-internet-history) [planned obsolesence](https://en.wikipedia.org/wiki/Planned_obsolescence). But it's not the end yet. There are still ways that you can utilize 32-bit machines with almost no noticable difference. This is what this guide is for. This will (hopefully) help you to survive in a 32-bit world.

Many are stuck with 32-bit only machines still today. Some Intel Atom processors are there still being used today, which is a good thing. If you have such a machine, don't throw it away. You can still use it today perfectly fine. If you are not a fan of it's performance, set it up, clean it and give it to a student in need. Don't contribute to tech trash because we already have lots of them.


## How do you know you have a 32-bit system?

Run `uname -m`. If it returns anything ending in `86` (e.g. `i686`), you are running a 32-bit operating system (OS).

This does not definitely mean that you can't run 64-bit OS. It is possible that you have a 64-bit capable CPU, but you are running a 32-bit OS. So run `lscpu|grep "CPU op-mode"` to see if your CPU supports 64-bit OS.

- If yes, take advantage of the availability of software for them and install a 64-bit OS
- If no, you're stuck with a 32-bit OS in a 32-bit machine and this guide may serve you some purpose


## Operating System

Ubuntu doesn't support 32-bit platform anymore. The last 32-bit Ubuntu was 17.04. It's already outdated, so don't use it.

There are many distros that [still support 32-bit](https://itsfoss.com/32-bit-os-list/), including some mainstream ones:
- Debian
- MX Linux
- Devuan
- CentOS
- Slackware
- Tiny Core Linux
- Alpine Linux
- Void Linux

Although Arch Linux has ended support for 32-bit architectures, there are 32-bit variants of it, such as [Arch Linux 32](https://archlinux32.org/), [Manjaro32](https://manjaro32.org/). If you have to use it, test before using for serious purposes, because they don't have official upstream support.

If I have to use a 32-bit OS, I would probably use Debian Testing or any of it's 32-bit supported derivatives like Devuan. Void Linux is also [great](https://www.reddit.com/r/voidlinux/comments/hxm9m2/found_a_20_year_old_computer_and_installed_void/) for old machines.


## Browser

- Use whatever is available on repo.
- Use [Tor Browser](https://www.torproject.org/download/languages/)
- For Chromium based browsers, [SRWare Iron](https://www.srware.net/iron/#downloads) is still probably available in 32-bit


## Node.js

Some unofficial builds of Node.js 32 bit can be downloaded from: \
[https://unofficial-builds.nodejs.org/](https://unofficial-builds.nodejs.org/)

### Getting at least v13.8.0 of Node

Some packages (like Hexo wordpress migrator, pnpm) might want at least 13.8.0.

```
# debian
sudo apt remove nodejs
# arch
sudo pacman -Rs nodejs
wget https://unofficial-builds.nodejs.org/download/release/v13.8.0/node-v13.8.0-linux-x86.tar.xz
xz --decompress node-v13.8.0-linux-x86.tar.xz
cd node-v13.8.0-linux-x86
sudo cp -r {bin,include,lib,share} /usr
```

You can also build from source. It's easy, just follow instructions in [this page](https://github.com/nodejs/node/blob/master/BUILDING.md#building-nodejs-on-supported-platforms). It's basically download, `./configure`, `make`.

To automate the build process and use multiple node versions (optional), you can use [nvm - node version manager](https://github.com/nvm-sh/nvm). When you want to install a version, it first looks for a 32-bit release file. If not available, which is common for any recent version, it will automatically download, build and install it from source for you.

To install nvm, just run the curl/wget command under [this section](https://github.com/nvm-sh/nvm#installing-and-updating). Then:

```
# nvm will add some code to a startup file (e.g. .bashrc, .xprofile - depending
# on distro). If you can't run `nvm`, `source` that file to use it on current
# shell without rebooting/relogin:
source ~/.bashrc
# or
source ~/.xprofile # or whatever
# To see all the versions available to install
nvm ls-remote
# To see the versions installed on your system
nvm ls
# To install a version
nvm install 13.12.0
# To use a version
nvm use 13.12.0
node --version # should return v13.12.0
# To run it directly
nvm run 13.12.0 --version
# To default to a version of node, run this. This is a must-run command if you
# want to use the nvm version of node automatically (and not the system one).
nvm alias default 13.12.0
# Congrats! You've got a moderately latest version of node installed!
# To use the system installation of node:
nvm alias default system
# Consult the nvm readme for more commands like this
```

I was successfully able to build and install these versions on a 32-bit system:
- 13.10.1
- 13.12.0

There might be other versions that may build successfully. Feel free to try.

### How about Node 15?

Node v15.x is still in development when I am writing this. But I found a branch of 15.x that solves a [build error for 32-bit builds](https://github.com/nodejs/node/issues/33019#issue-605413017) that 14.x versions used to raise. For that I had to build a specific [branch](https://github.com/richardlau/node-1/tree/gypfiles) of a fork (which will hopefully be merged to master someday). The wonderful thing is that [it works](https://github.com/nodejs/node/issues/33019#issuecomment-652547863). So this will give you Node 15.0.0-pre on your 32-bit system:

```
$ sudo apt install build-essential libssl-dev python3-distutils
$ git clone -b gypfiles https://github.com/richardlau/node-1.git
$ cd node-1
$ ./configure
$ make -j 3
$ sudo make install
$ node --version
v15.0.0-pre
```


## LAMPP

I need to use Apache, PHP, MySQL, phpMyAdmin etc. I used to use XAMPP for running all sorts of stuff including WordPress. But the last 32-bit version they released is [PHP 7.0.8](https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/7.0.8/) on 2016, which is old and deprecated.

A better way is to install Apache, PHP etc. from the repo and configure as needed. You can use guides from [this repo](https://notabug.org/adnan360/code-backups/src/master/linux-localhost) for a basic setup or use any other guide from anywhere else.


## Invidious

Invidious is an alternative YouTube frontend with privacy in mind. It's Free Software (AGPL) and without all the Polymer UI, traking cookies and stuff. YouTube is a nice learning platform. So Invidious provides a great way to enjoy YouTube without actually going to youtube.com.

Invidious has 2 ways to install. One of them is a Docker container which is convenient, but does not support 32-bit systems. So you'll have to install natively. Just follow the [instructions](https://github.com/iv-org/invidious#linux) but pause before the `crystal build src/invidious.cr --release` line because it will fail on a 32-bit system.

Assuming you've followed the instructions, you should be logged in as `invidious` user. Now do a `cd ~` and then continue:

1. [Build Boringssl](https://github.com/litespeedtech/lsquic#building-boringssl)

BoringSSL deps that I needed to install:
```
sudo apt instlal zlibc libevent cmake build-essential golang
```

Then to build:

```
git clone https://boringssl.googlesource.com/boringssl
cd boringssl
cmake . &&  make
BORINGSSL=$PWD # important for later!
cd ..
```

2. [Build LSQUIC](https://github.com/litespeedtech/lsquic#building-lsquic-library)

```
git clone https://github.com/litespeedtech/lsquic.git
cd lsquic
git submodule init
git submodule update
export CFLAGS+=" -Wno-int-to-pointer-cast -Wno-overflow -Wno-sign-compare"
cmake -DBORINGSSL_DIR=$BORINGSSL -DBORINGSSL_INCLUDE=$BORINGSSL/include .
make
cd ..
```

__Note:__ Setting `CFLAGS` allows the build to be successful, but I haven't tested how stable the builds are.

3. Prepare `liblsquic.a`

```
mkdir -p /tmp/install
mv {lsquic/src/liblsquic/liblsquic.a,boringssl/ssl/libssl.a,boringssl/crypto/libcrypto.a} /tmp/install
cd /tmp/install
ar -x liblsquic.a
ar -x libssl.a
ar -x libcrypto.a
rm *.a
ar rc liblsquic.a *.o
strip -x -S liblsquic.a 
ranlib liblsquic.a
```

Now you should have a `liblsquic.a` file.

```
mv ~/invidious/lib/lsquic/src/lsquic/ext/liblsquic.a ~/invidious/lib/lsquic/src/lsquic/ext/liblsquic.a.bak
cp -i liblsquic.a ~/invidious/lib/lsquic/src/lsquic/ext/liblsquic.a
```

5. Then continue with `cd ~/invidious` and then `crystal build src/invidious.cr --release` and so on.
